Skip to content

fix(cli): Ignore SIGPIPE to prevent crashes on broken pipes - #40

Merged
philprime merged 1 commit into
mainfrom
seer/fix/ignore-sigpipe
Sep 30, 2026
Merged

philprime merged 1 commit into
mainfrom
seer/fix/ignore-sigpipe

Conversation

@sentry

@sentry sentry Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

This PR addresses an issue where the CLI would crash with a SIGPIPE signal when its stdout was piped to another command that exited early (e.g., apple-docs ... | head -n 1).

The root cause was that the application did not explicitly ignore the SIGPIPE signal. By default, writing to a pipe whose reader has closed results in a SIGPIPE signal, which terminates the process.

The fix involves calling signal(SIGPIPE, SIG_IGN) in AppleDocs.main() to instruct the operating system to ignore this signal. This ensures that writes to a broken pipe will instead fail with an EPIPE error, allowing the CLI to exit gracefully without crashing.

The signal(SIGPIPE, SIG_IGN) call is placed after telemetry.start() to ensure it takes precedence over any SIGPIPE handler that Sentry's crash reporter might install during its initialization.

Fixes APPLE-DOCS-CLI-3

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@philprime
philprime merged commit 129e3b0 into main Sep 30, 2026
14 checks passed
@philprime
philprime deleted the seer/fix/ignore-sigpipe branch September 30, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant